package com.foreveross.bsl.mongodb.domain.repository;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.NoRepositoryBean;

import com.foreveross.bsl.common.utils.enums.OperatEnum;
import com.foreveross.bsl.common.utils.web.QuerySpecs;

@NoRepositoryBean
public interface EntityRepository<T,ID extends Serializable> extends MongoRepository<T, ID>{

	List<T> findListByQuery(Query query);
	
	List<T> findListByProperty(String proName, OperatEnum operat, Object value);

	List<T> findListByProperty(String[] proName, OperatEnum[] operat, Object[] value);
	
	Page<T> findByQuery(Query query);
	
	Page<T> findByQuery(Query query, Pageable pageable);
	
    Page<T> findByProperty(String proName, OperatEnum operat, Object value, Pageable pageable);

    Page<T> findByProperty(String[] proName, OperatEnum[] operat, Object[] value, Pageable pageable);
    
	T findOneByProperty(String proName, OperatEnum operat, Object value);

	T findOneByProperty(String[] proName, OperatEnum[] operat, Object[] value);
    
	void deleteByProperty(String proName, OperatEnum operat, Object value);

	void deleteByProperty(String[] proName, OperatEnum[] operat, Object[] value);
	
	Page<T> findByQuerySpecs(QuerySpecs querySpecs, Pageable pageable);
}
